Declare Function GetSysColor Lib "User" (ByVal nIndex As Integer) As Long
Declare Sub SetSysColors Lib "User" (ByVal nChanges As Integer, lpSysColor As Integer, lpColorValues As Long)
' //** Note - ALIAS names should not conflict with normal declarations//
Declare Function Beeper Lib "User" Alias "MessageBeep" (ByVal BeepType As Integer) As Integer
Declare Function GetVer Lib "Kernel" Alias "GetVersion" () As Long
Declare Function ReadFromINI Lib "Kernel" Alias "GetPrivateProfileString" (ByVal Topic As String, ByVal Keyname As String, ByVal DEFAULT As String, ByVal ReturnedString As String, ByVal maxsize As Integer, ByVal Filename As String) As Integer
Declare Function WriteToINI Lib "Kernel" Alias "WritePrivateProfileString" (ByVal Topic As String, ByVal Keyname As String, ByVal NewString As String, ByVal Filename As String) As Integer
Declare Function GetUsersWINDIR Lib "Kernel" Alias "GetWindowsDirectory" (ByVal ipbuffer As String, ByVal nSize As Integer) As Integer
' //There are 21 System Colours in Windows 3.1//
Dim ColourText(0 To 20) As String
Dim IndexArray(0 To 20) As Integer
Dim RGBArray(0 To 20) As Long
Dim OldRGBArray(0 To 20) As Long
Dim NumChanges As Integer
Dim WINDIR As String' //Users Windows Directory//
Sub EnumerateSchemes ()
' //Last edited 02/07/94 [GB] //
' //+++PUBLIC+++//
' //Initialises Scheme(1 to ?) and i_LastScheme//
' //Scheme() is a dynamic array of CONTROL.INI Colour Scheme names//
' //i_LastScheme is the number of the last valid entry//
If IsWin31() = False Then
TellBadNews' //Windows 3.1 only//
Exit Sub
End If
Dim sz_Buf As Variant
Dim sz_Topic As String
Dim sz_Filename As String
Dim fn As Integer' //File Handle//
Dim pos As Integer
fn = FreeFile
sz_Topic = "[color schemes]"
If WINDIR = "" Then WINDIR = GetWINDIR()
sz_Filename = WINDIR
If Right$(sz_Filename, 1) <> "\" Then sz_Filename = sz_Filename & "\"
sz_Filename = sz_Filename & "CONTROL.INI"
' //Find the [color schemes] topic
Open sz_Filename For Input As #fn
Do Until EOF(fn)
Input #fn, sz_Buf
If Len(sz_Buf) > 14 Then
If Left$(sz_Buf, 15) = sz_Topic Then Exit Do
End If
Loop
' //Enumerate the keynames//
Do Until EOF(fn)
Input #fn, sz_Buf
If Len(sz_Buf) > 1 And Left$(sz_Buf, 1) = "[" Then Exit Do
pos = InStr(1, sz_Buf, "=")
If pos Then sz_Buf = Left$(sz_Buf, pos - 1)
If pos Then
i_LastScheme = i_LastScheme + 1
ReDim Preserve Scheme(1 To i_LastScheme)
Scheme(i_LastScheme) = sz_Buf
End If
Loop
End Sub
Sub GetSysColoursFromINI (SchemeString As String, IniPath As String)
' //Last edited 02/07/94 [GB] //
' //+++PUBLIC+++//
' //Sets the System Colours from an INI File (CONTROL PANEL style) saved Scheme setting//
If SchemeString = "" Then Exit Sub' //Failed Test//
If IsWin31() = False Then
TellBadNews' //Windows 3.1 only//
Exit Sub
End If
' //Test if RGBArray contains valid entries//
If RGBARRAY_SET_OK = False Then Init_RGBArray' //Also sets IndexArray//
' //Do simple checks//
On Error GoTo EH_GSCError
If Dir$(IniPath) = "" Then Exit Sub' //Failed Test//
If SchemeString = "" Then Exit Sub' //Failed Test//
' //Set up vars for DLL call//
Dim INIEntry As String
Dim i_RetVal As Integer
Dim sz_Bad As String
sz_Bad = "unknown"
Dim sz_Buf As String * 255
Dim i_SizeOfBuf As Integer
i_SizeOfBuf = 255
' //Fetch the CSV string containing the 20 Hex numbers//